#include <bits/stdc++.h>

using namespace std;

// 直接枚举 a,b来构造 aabb型
int main() {
    for (int a = 0; a <= 9; a++) {
        for (int b = 0; b <= 9; b++) {
            int i = a * 1000 + b * 100 + b * 10 + a;
            int r = (int)sqrt(i);
            if (r * r == i) {
                cout << i << endl;
            }
        }
    }

    return 0;
}
